package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "服务项接口")
public class CustomerOrdersController extends BaseController {

    @Autowired
    private com.zzyl.service.NursingProjectService nursingProjectService;

    //1.1 分页查询护理项目列表
    @GetMapping("/customer/orders/project/page")
    @ApiOperation(value = "分页查询护理项目列表", notes = "传入分页条件")
    public ResponseResult<NursingProjectVo> findByPage(
            @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(name = "name", required = false) String name,
            @RequestParam(name = "status", required = false) Integer status) {
        PageResponse<NursingProjectVo> responseResult = nursingProjectService.findByPage(pageNum, pageSize, name, status);
        return success(responseResult);
    }

    //1.2 根据编号查询护理项目信息
    @GetMapping("/customer/orders/project/{id}")
    @ApiOperation(value = "根据编号查询护理项目信息", notes = "传入查询id")
    public ResponseResult<NursingProjectVo> findById(@PathVariable(name = "id") Long id) {
        NursingProjectVo nursingProjectvo = nursingProjectService.findById(id);
        return success(nursingProjectvo);
    }

}
